package com.example.a1.fannong.core;


/**
 * 程序配置类
 */
public class Config {

    public static final String baseUrl;
    public static final String imagUrl;
    public static final String aliimagUrl;

    /**
     * 服务器 名称
     */
    public static final ServerName server = ServerName.TEST;

    static {
        switch (server) {
            case TEST:
                baseUrl = "http://test.isum.cn/wisdom/app";
                imagUrl = "http://test.isum.cn/wisdom/images";
                aliimagUrl = "http://jmd.ali181.com/";
                break;

            case RELEASE:
                baseUrl = "";
                imagUrl = "";
                aliimagUrl = "";
                break;

            default:
                throw new RuntimeException("请配置服务器地址");
        }

    }


    private enum ServerName {
        /**
         * 测试服务器
         */
        TEST,

        /**
         * 正式服务器
         */
        RELEASE
    }

    /**
     * 获取引导页的url
     *
     * @param fileName
     * @return
     */
    public static String getAppGuideUrl(String fileName) {
        return imagUrl + "/topSwitch/" + fileName;
    }

    /**
     * 获取图片的url
     * @param fileName
     * @return
     */
    public static String getImageUrl(String fileName){
        return "http://test.isum.cn/images/" + fileName;
    }
    /**
     * 宝典
     *
     * @param fileName
     * @return
     */
    public static String getBookPageUrl(String fileName) {
        return imagUrl + "/article/" + fileName;
    }


    /**
     * 获取头像url
     *
     * @param fileName
     * @return
     */
    public static String getAvatarUrl(String fileName) {
        return imagUrl + "/user/" + fileName;
    }

    /**
     * 获取商品图片
     *
     * @param fileName
     * @return
     */
    public static String getGoodImageUrl(String fileName) {
        return "http://jmd.ali181.com" + fileName;
    }

}
